@extends('host.custom.common.common')

@section('body')
        <!-- top_test -->
<div id="top_test"></div>

<!-- web_logo_search -->
<div id="web_logo_search"></div>

<!-- comm_nav -->
<div id="comm_nav"></div>

<div class="com-w mt20">
    <div class="wrapper clearfix">
        <div  class="w220 mr20 comm-left-menu">
            <div class="menu-top-title">供应商中心</div>
            <div id="leftmenuitems"></div>
        </div>

        <div class="w960 comm-main">
            <div class="main-release clearfix">
                <div class="main-release-nav">
                    您当前的位置：
                    <a href="javascript:void(0)">首页</a>
                    >
                    <a href="javascript:void(0)">供应商中心 ></a>
                    <a href="javascript:void(0)">订单管理 ></a>
                    订单详情
                </div>
                <div class="main-release-title">
                    <span class="icons"></span>
                    <span class="release-title-h3 f16">订单详情</span>
                </div>
                <div class="main-release-from">
                    <div class="order-top clearfix">
                        <div class="clearfix">
                                <span class="order-left">
                                    订单状态：
                                    <span class="order-state">{{ ['异常订单', '等待物流报价', '待付款', '已付款', '待收货', '已收货，待评论', '订单完成'][$order->status] }}</span>
                                </span>
                                <span class="order-left">
                                    订单编号：
                                    <span class="order-number">{{ $order->order_code }}</span>
                                </span>
                                <span class="order-left">
                                    下单时间：
                                    <span class="order-time">{{ date('Y-m-d H:i:s', strtotime($order->created_at)) }}</span>
                                </span>
                        </div>
                        <div class="order-schedule-{{ $order->status }}"></div>
                    </div>
                    <div class="order-info">
                        <div class="goods-info">
                            <div class="lh35 ml15">商品信息</div>
                        </div>
                        <div class="goods-table  clearfix">
                            <ul class="clearfix">
                                <li>
                                    店铺名：
                                    <a class="company-name">{{ $order->provider->information->company }}</a>
                                </li>
                                <li>
                                    电话号码：
                                    <span>{{ $order->provider->information->contact_phone }}</span>
                                </li>
                                <li>
                                    所在地区：
                                    <span>{{ \App\B2BProject\Area::getName($order->provider->information->province_id) }}</span>
                                    <span>{{ \App\B2BProject\Area::getName($order->provider->information->city_id) }}</span>
                                </li>
                                <li>
                                    详细地址：
                                    <span>{{ $order->provider->information->address }}</span>
                                </li>
                            </ul>
                        </div>
                        <div class="goods-tab">
                            <div class="head">
                                <ul class="clearfix">
                                    <li class="wb10"></li>
                                    <li class="wb30 tl">商品名称</li>
                                    <li class="wb20">单价</li>
                                    <li class="wb20">采购数量</li>
                                    <li class="wb20">小计</li>
                                </ul>
                            </div>
                            <div class="goods-tab-list wbb">
                                @foreach($order->specifications as $spec)
                                <ul class="clearfix">
                                    <li class="wb10">
                                        <a href="javascript:void(0)">
                                            <img src="{{ $spec->goods_cover }}"></a>
                                    </li>
                                    <li class="wb30 tl ">
                                        <span class="c-coffee f14 mt20 fl lh14">{{ $spec->goods_name }}</span>
                                            <span class="c-999 fl mt15">

                                            </span>
                                    </li>
                                    <li class="wb20 b002 f14">￥{{ sprintf("%.2f", $total = $spec->original_price * $spec->price_strategy) }}</li>
                                    <li class="wb20 c-666 f14">{{ $spec->amount }}</li>
                                    <li class="wb20 b002 f14">￥{{ sprintf("%.2f", $total * $spec->amount) }}</li>
                                </ul>
                                @endforeach
                            </div>
                            <div class="goods-bottom">
                                <div class="bottom-left">
                                    总价：
                                    <span class="pay-num">￥{{ sprintf("%.2f", $order->total_amount + $order->logistics_price) }}</span>
                                </div>
                                <div class="bottom-left">
                                    运费：
                                    <span class="pay-way f14">@if($order->status == 1)等待物流报价@else ￥{{ sprintf("%.2f", $order->logistics_price) }}@endif</span>
                                </div>
                                <div class="bottom-left">
                                    支付方式：
                                    <span class="pay-way f14">#</span>
                                </div>
                            </div>
                        </div>
                        <div class="order-track">
                            <div class="goods-info">
                                <div class="lh35 ml15">订单跟踪</div>
                            </div>
                            <div class="track-main">
                                <div class="spanbox" style="margin-left: 120px;">
                                    <span class="left">支付留言：</span>
                                    <span class="right">未支付</span>
                                    <br>
                                    <span class="left">下单时间：</span>
                                    <span class="right">{{ date('Y-m-d H:i:s', strtotime($order->created_at)) }}</span>
                                    <br>
                                    @if($order->status >= 3)
                                    <span class="left">支付时间：</span>
                                    <span class="right">{{ date('Y-m-d H:i:s', strtotime($order->pay_time)) }}</span>
                                    @endif
                                    <br>
                                    @if($order->status >= 4)
                                    <span class="left">发货时间：</span>
                                    <span class="right">{{ date('Y-m-d H:i:s', strtotime($order->ship_time)) }}</span>
                                    @endif
                                    <br>
                                    @if($order->status >= 6)
                                    <span class="left">完成时间：</span>
                                    <span class="right">{{ date('Y-m-d H:i:s', strtotime($order->finish_time)) }}</span>
                                    @endif
                                </div>
                            </div>
                        </div>
                        <div class="order-track">
                            <div class="goods-info">
                                <div class="lh35 ml15">收货人及物流信息</div>
                            </div>
                            <div class="track-main">
                                <div class="spanbox" style="margin-left: 120px;">
                                    <span class="left">收货地址：</span>
                                    <span class="right">{{ $order->delivery_address }}</span>
                                    <br>
                                    <span class="left">收货人：</span>
                                    <span class="right">{{ $order->consignee }}</span>
                                    <br>
                                    @if($order->status >= 4)
                                        <span class="left">物流公司：</span>
                                        <span class="right">德邦物流</span>
                                        <br>
                                        <span class="left">物流单号：</span>
                                        <span class="right">D235145275566</span>
                                        <br>
                                        <span class="left">物流单据：</span>
                                        <span class="right">
                <a href="javascript:void(0)">点击查看图片</a>
            </span>
                                        <br>
                                    @endif

                                </div>
                            </div>
                        </div>
                        <div class="order-track">
                            <div class="goods-info">
                                <div class="lh35 ml15">发票信息</div>
                            </div>
                            <div class="track-main">
                                <div class="spanbox" style="margin-left: 120px;">
                                    <span class="left">发票类型：</span>
                                    <span class="right">{{ ['普通发票', '增值税发票'][$order->invoice_type - 1] }}</span>
                                    <br>
                                    <span class="left">单位名称：</span>
                                    <span class="right">{{ $order->invoice_subject }}</span>
                                    <br>
                                </div>
                            </div>
                        </div>
                        <div class="order-track">
                            <div class="goods-info">
                                <div class="lh35 ml15">操作历史</div>
                            </div>
                            <div class="track-main">
                                @forelse($order->operateHistory()->get() as $history)
                                    @if($history->event == "adjust-price-logistics")
                                        <div class="spanbox" style="margin-left: 120px;">
                                            <span class="company-name">{{ $history->operator->class == 1 ? $history->operator->information->company : $history->operator->user }}</span>
                                            <span class="right">在 {{ date('Y-m-d H:i:s', strtotime($history->created_at)) }} 进行物流报价</span>
                                            <span>￥ {{ json_decode($history->data)->logistics->to }}</span>
                                            </br>
                                        </div>
                                    @elseif($history->event == "adjust-price-only")
                                        <div class="spanbox" style="margin-left: 120px;">
                                            <span class="company-name">{{ $history->operator->class == 1 ? $history->operator->information->company : $history->operator->user }}</span>
                                            <span class="right">在 {{ date('Y-m-d H:i:s', strtotime($history->created_at)) }} 将价格由</span>
                                            <span>￥ {{ json_decode($history->data)->order_price->from }}</span>
                                            <span class="right">调整为</span>
                                            <span>￥ {{ json_decode($history->data)->order_price->to }}</span>
                                            </br>
                                        </div>
                                    @endif

                                @empty
                                @endforelse
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- foot_nav -->
<div id="foot_nav"></div>
<div id="bottom_main"></div>

<script type="text/javascript" src="/assets/b2b/js/libs/jquery.validate.min.js"></script>
<script src="/assets/b2b/js/libs/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){
        //渲染 top left
        commTemplUtil.initPage();
        commTemplUtil.initCommLeftMemu();
        //左边导航选中
        commTemplUtil.setLeftMenu(4);
    });
</script>
@stop